jQuery(document).ready(function(){

if(dateMainAllField!=null&&dateMainAllField!=""){
var dateMainAllFieldID=dateMainAllField.split(",");
var dateMainAllFieldIDs="";
for(var i=0;i<dateMainAllFieldID.length;i++){
dateMainAllFieldIDs=dateMainAllFieldIDs+WfForm.convertFieldNameToId(dateMainAllFieldID[i])+",";
}
if(dateMainAllFieldIDs!=""){
dateMainAllFieldIDs=dateMainAllFieldIDs.slice(0,dateMainAllFieldIDs.length-1);
}
WfForm.bindFieldChangeEvent(dateMainAllFieldIDs,function(obj,id,value){
if(value!=""&&value!=null){
    jQuery.ajax({
        url: "/api/weavernorth/attend/checkDate",
        data:{"dateValue":value},
        success: function (data) {

        if(data=='1'){
          alert("请选择当前日期的前后30个自然日内的日期");
           WfForm.changeFieldValue(id, {value: ""});
        }

        },
        error: function () {  //请求失败时被调用的函数
            alert("加载失败，请联系管理员！")
        }
    });
    }


})
}



//明细表字段

if(dateDetailAllField!=null&&dateDetailAllField!=""){
var dateDetailAllFieldID=dateDetailAllField.split(",");
var dateDetailAllFieldIDs="";
for(var i=0;i<dateDetailAllFieldID.length;i++){
dateDetailAllFieldIDs=dateDetailAllFieldIDs+WfForm.convertFieldNameToId(dateDetailAllFieldID[i])+",";
}
if(dateDetailAllFieldIDs!=""){
dateDetailAllFieldIDs=dateDetailAllFieldIDs.slice(0,dateDetailAllFieldIDs.length-1);
}
WfForm.bindFieldChangeEvent(dateDetailAllFieldIDs,function(obj,id,value){
if(value!=""&&value!=null){
    jQuery.ajax({
        url: "/api/weavernorth/attend/checkDate",
        data:{"dateValue":value},
        success: function (data) {

        if(data=='1'){
          alert("请选择当前日期的前后30个自然日内的日期");
           WfForm.changeFieldValue(id, {value: ""});
        }

        },
        error: function () {  //请求失败时被调用的函数
            alert("加载失败，请联系管理员！")
        }
    });
    }


})
}


})